CPIO
Section: User Commands (1)
Updated: 6 September 1988
Index
Return to Main Contents
NAME
cpio - copy file archives in and out
SYNOPSIS
cpio -o
[
aBcv
]
cpio -i
[
bBcdfmrsStuv6
]
[
patterns
]
cpio -p
[
adlmuv
]
directory
DESCRIPTION
cpio
copies files in to and out from a
cpio
copy archive. The archive (built by
`cpio -o')
contains pathname and status information, along with the
contents of one or more archived files.
OPTIONS
- -o
-
Copy out an archive. Read the standard input for a list of
pathnames, then copy the named files to the standard
output in archive form --- including pathname and status
information.
-
- a
-
Reset the access times of input files after they have been copied.
- B
-
Output is to be blocked at 5120 bytes to the record. This does
not apply to the
pass
option. This option is only meaningful with data directed to
raw magnetic devices, such as
`/dev/rmt?'.
- c
-
Write
header
information in
ASCII
character form for portability.
- v
-
Verbose. A list of filenames is displayed. When used with the
t
option, the table of contents looks like the output of an
`ls -l'
command (see
ls(1V)).
- -i
-
Copy in an archive. Read in an archive from the standard input
and extract files with names matching filename substitution
patterns,
supplied as arguments.
-
patterns
are similar to those in
sh(1)
or
csh(1),
save that
within
cpio,
the metacharacters
`?',
`*'
and
`[ ... ]'
also match the
`/'
(slash)
character. If no
patterns
are specified, the default is
*
(select all files).
-
- b
-
Swap both bytes and half-words after reading in data.
- B
-
Input is to be blocked at 5120 bytes to the record. This does
not apply to the
pass
option. This option is only meaningful with data received from
raw magnetic devices, such as
`/dev/rmt?'.
- d
-
Create directories as needed.
- f
-
Copy in all files except those matching
patterns.
- m
-
Retain previous file modification time.
This option is ineffective on
directories that are being copied.
- r
-
Interactively
rename files. If the user types a null line, the file is skipped.
May not be used with the
-p
option.
- s
-
Swap bytes after reading in data.
- S
-
Swap halfwords after reading in data.
- t
-
Print a table of contents
of the input archive. No files are created.
- u
-
Copy unconditionally.
Normally, an older file will not replace a newer file with the same
name.
- 6
-
Process
UNIX
Version-6 files.
- -p
-
One pass. Copy in and out in a single operation. Destination
pathnames are interpreted relative to the named
directory.
-
- l
-
Whenever possible, link files rather than copying them.
EXAMPLES
To copy the contents of a directory into an archive:
-
example% ls | cpio -o > /dev/mt0
To read a cpio archive from a tape drive:
-
example% cpio -icdB < /dev/rmt0
To duplicate the
olddir
directory hierarchy in the
newdir
directory:
-
example% cd olddir
example% find . -depth -print | cpio -pdl newdir
The trivial case
-
example% find . -depth -print | cpio -oB >/dev/rmt0
can be handled more efficiently by:
-
example% find . -cpio /dev/rmt/0m
cpio
archive tapes from other sites may have bytes swapped
within the archive. Although the
-is
option only
swaps the data bytes and not those in the header
cpio
recognizes tapes like this and swaps the bytes in the header
automatically.
SEE ALSO
ar(1V),
csh(1),
find(1),
ls(1V),
sh(1),
tar(1),
cpio(5)
BUGS
cpio
does not support multiple volume tapes.
Pathnames are restricted to 128 characters. If there are too many
unique linked files,
cpio
runs out of memory and linking information is lost
thereafter. Only the super-user can copy special files.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- EXAMPLES
-
- SEE ALSO
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 04:54:16 GMT, January 31, 2023